package com.bzg.baseSpringComponent.typeConverter;

import java.beans.PropertyEditorSupport;

/**
 * String 转 User
 * PropertyEditor是jdk提供的属性编辑器接口，PropertyEditorSupport是对其支持的子类。
 * spring对PropertyEditor做了支持。PropertyEditor比较简单，功能也没有spring的converter强大
 * */
public class StringToUserPropertyEditor extends PropertyEditorSupport {

	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		if(text != null) {
			User user = new User(text);
			setValue(user);
		}
	}
}
